#ifndef MYGAME_H
#define MYGAME_H
#include "Engine.h"
#include "userStates.h"
#include "LevelList.h"
#include "Level.h"
#include "LevelMap.h"
#include "PenjinTypes.h"
#include "WandorBaseState.h"
#include "GameState.h"

/*
PROJECT: Wandor
This is the customised game engine class, all overridden code is written here and differs depending on your game.
*/

class MyGame : public Engine
{
	private:
        static MyGame* m_MyGame;
	public:
        static MyGame* GetMyGame();

		MyGame();
		virtual ~MyGame();

		virtual PENJIN_ERRORS init();
		virtual void stateManagement();
        PENJIN_ERRORS argHandler(int argc, char **argv);

		string GetPassword() {return password;}
		void SetPassword(CRstring password);
		void SetLevelFileName(CRstring filename);
        void SetLevelData(LevelData level);
        void SetCurrentLevelMapName(string name) {currentLevelMapName = name;}

		void PushState(WandorBaseState *newState);
		WandorBaseState *PopState(); // returns the active level after the pop
		void PushNewLevel(); // call SetPassword & SetLevelFileName first
		void loadLevelList(CRstring filename);

        STATE_TYPE GetStateType();
		Level *GetCurrentLevel();
		LevelMap *GetCurrentLevelMap();
        LevelData GetNextLevel(CRstring filename);
        string GetCurrentLevelMapName() {return currentLevelMapName;}

        GameState *GetGameState() { return gameState; }
        void LoadSaveGame(string filename);
    private:
        bool testLevel;
        string customControlMap;
        string password;
        string currentLevelMapName;
        LevelData levelData;
        vector<WandorBaseState *> stateStack;
        void *nextState;
        LevelList *levelList;
        GameState *gameState;
};


#endif	//	MYGAME_H
